package com.dnf.util;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

/**
 * @author Administrator
 *
 */
public class UrlCodeUtil {
public static String decodeUrl(String field)
{
	String decodedField="";
	try {
		decodedField = URLDecoder.decode(field, "gb2312");
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
	return decodedField;
}
public static String encodeUrl(String field)
{
	String encodedField="";
	try {
		encodedField = URLEncoder.encode(field, "gb2312");
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
	return encodedField;
}
public static void main(String[] args) {
	System.out.println(decodeUrl("%c1%fa%d6%ae%cc%f4%d5%bd"));
	System.out.println(encodeUrl("2018-04-20"));
}
}
